﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SSE657.BahMap.DataAccess.Text;
using SSE657.BahMap.Common;
using SSE657.BahMap.DataAccess.SQLServer;
using SSE657.BahMap.DataAccess;

namespace SSE657.BahMap.Business
{
    /// <summary>
    /// Master class for accessing BAH Map domain methods
    /// </summary>
    public class BAHMapSession : IBAHMapSession
    {
        private RateManager _rateManager;
        private SchoolsManager _schoolsManager;
        // TODO: add DTOD manager (future iteration)

        public BAHMapSession()
        {
            // tight coupling; can change later
            _rateManager = new RateManager(new BAHDataTextConnector());
            _schoolsManager = new SchoolsManager(new SchoolDataTextConnector());
        }

        #region RateManager
        public List<RateData> GetRates(PayGrade grade, bool dependents)
        {
            return _rateManager.GetRates(grade, dependents);
        }

        public Dictionary<RateData, double> GetRatesPercentiles(PayGrade grade, bool dependents)
        {
            return _rateManager.GetRatesPercentiles(grade, dependents);
        }

        public KeyValuePair<double, double> GetRatePercentile(int zip, PayGrade grade, bool dependents)
        {
            return _rateManager.GetRatePercentile(zip, grade, dependents);
        }

        // how does consumer want the data of all rates in a specified ZIP/MHA? Table? List? Dictionary of PayGrade to Rates, or of dependents to Rates?
        public Dictionary<PayGrade, Dictionary<bool, RateData>> GetAllRates(int zipcode)
        {
            return _rateManager.GetRates(zipcode);
        }

        public Dictionary<PayGrade, Dictionary<bool, RateData>> GetAllRates(string mha)
        {
            return _rateManager.GetRates(mha);
        }

        #endregion

        #region SchoolsManager
        public IEnumerable<SchoolData> GetSchools(string MHA)
        {
            return _schoolsManager.GetSchools(MHA);
        }

        public IEnumerable<SchoolData> GetSchools(int zipcode)
        {
            return _schoolsManager.GetSchools(zipcode);
        }
        #endregion

        #region DTODManager
        // TODO: Add DTOD methods here
        #endregion
    }
}
